import Request from "@/utils/request";
import { LOGIN } from "@/type/paramsType/parmsType";
import { USERINFO } from "@/type/resType/userResType";

class UserRequest extends Request {
    // 用户登录接口：向尚硅谷的服务器发请求
    userLogin = (payloadObj: LOGIN) => {
        return this.post<USERINFO>({
            url: `/user/passport/login`,
            data: payloadObj
        }, "pass");
    }
    // 根据token来获取用户的详细信息
    getUserDetailInfo = () => {
        return this.get<USERINFO>({
            url: "/user/passport/auth/getUserInfo"
        }, "pass");
    }
    // 退出登录
    logoutReqHandler = () => {
        return this.get<null>({
            url: `/user/passport/logout`
        }, "pass");
    }
}

export default new UserRequest();